import { createRouter, createWebHashHistory } from 'vue-router'

const Home = () => import('@/views/Home' /* webpackChunkName: "home" */)
const Singer = () => import('@/views/Singer' /* webpackChunkName: "singer" */)
const SingerDetail = () => import('@/views/SingerDetail' /* webpackChunkName: "singer-detail" */)
const TopList = () => import('@/views/TopList' /* webpackChunkName: "top-list" */)
const Search = () => import('@/views/Search' /* webpackChunkName: "search" */)
const UserCenter = () => import('@/views/UserCenter' /* webpackChunkName: "user-center" */)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: Home
  },
  {
    path: '/singer',
    name: 'singer',
    component: Singer,
    children: [
      {
        path: ':id',
        component: SingerDetail
      }
    ]
  },
  {
    path: '/top-list',
    name: 'top-list',
    component: TopList
  },
  {
    path: '/search',
    name: 'search',
    component: Search
  },
  {
    path: '/user',
    components: {
      user: UserCenter
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
